﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;


namespace ESupervision.Models
{
    public class Message
    {

        public int ID { get; set; }

        [Required]
        
        public string SentByUserId { get; set; }

        [Required]
        [MaxLength(1000)]
        public string Subject { get; set; }

        [Required]
        [MaxLength(4000)]
        public string Body { get; set; }

        [Required]
        [DataType(DataType.DateTime)]
        [Display(Name = "Time")]
        public DateTime SentTime { get; set; }

        [ForeignKey("SentByUserId")]
        public virtual ApplicationUser Sender { get; set; }

        [InverseProperty("Message")]
        public virtual ICollection<MessageRecipient> MessageRecipients { get; set; }

        [InverseProperty("Message")]
        public virtual ICollection<MessageSent> MessageSents { get; set; }
    }
}